package com.itheima.day15.TCP.test5;

import java.io.*;
import java.net.Socket;

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("10.254.1.79",10006);

        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("backBurner\\a\\源氏头像.jpg"));
        OutputStream os = s.getOutputStream();
        BufferedOutputStream bos = new BufferedOutputStream(os);
        int i;
        while ((i = bis.read()) != -1){
            bos.write(i);
        }
        s.shutdownOutput();

        BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String str;
        while((str = br.readLine()) != null){
            System.out.println(str);
        }

        bis.close();
        s.close();
    }
}
